---
category: Misc
contributors:
    - furkankose
created: '2020-05-06'
openGraphCover: /og/1-loc/wait-amount-time.png
title: Wait for an amount of time
updated: '2021-10-13'
---

**JavaScript version**

```js wait.js
const wait = async (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
```

**TypeScript version**

```ts wait.ts
const wait = async (milliseconds: number) => new Promise((resolve) => setTimeout(resolve, milliseconds));
```

## See also

-   [Wait for the next event loop](https://phuoc.ng/collection/1-loc/wait-for-the-next-event-loop/)
